package com.dianneng.show.widget;

import android.content.Context;
import android.widget.TextView;

import com.dianneng.show.R;
import com.dianneng.show.model.DayInfo;
import com.github.mikephil.charting.components.MarkerView;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.utils.MPPointF;

public class XYMarkerView extends MarkerView {
    private TextView tvContent;
    private Context mContext;


    public XYMarkerView(Context context) {
        super(context, R.layout.custom_marker_view);
        mContext=context;
        tvContent = findViewById(R.id.tvContent);
    }

    @Override
    public void refreshContent(Entry e, Highlight highlight) {
        tvContent.setText("当日用电量：" + e.getY()+"kW·h");
        super.refreshContent(e, highlight);
    }

    @Override
    public MPPointF getOffset() {
        return new MPPointF(-(getWidth() / 2), -mContext.getResources().getDimension(R.dimen.dp_400));
    }
}
